<cfset user = viewState.getValue("users") />
<cfset roles = viewState.getValue("roles") />

<cfoutput>

<h2>
<cfif user.hasID() and user.getUserID() EQ "">
	Create User Profile
<cfelse>
	Update User Profile
</cfif>
</h2>
<form action="#viewstate.getValue("myself")#processUserEntryForm" method="post">
	<input type="hidden" id="userID" name="userID" value="#user.getuserID()#">

	<p><b>*</b> fields are required. </p>
	<fieldset >
	<legend>User Information</legend>
		<cfif user.getUserID() eq ''>
		<label for="username">* Username: </label>
			<input type="text" id="uname" name="uname"  value="#user.getusername()#" title="Enter your username."><br>
		<label for="pword">* Password: </label>
			<input type="password" id="pword" name="pword" title="Enter your password."><br>
		<label for="confirmpword">* Confirm Password: </label>
			<input type="password" id="confirmpword" name="confirmpword" title="Confirm your password."><br>
		
		<cfelse>
		<label for="username">Username: </label> #user.getusername()#<br>
		<label for="newpassword">New Password: </label>
			<input type="password" id="newpassword" name="newpassword" title="Enter your password."><br>
		<label for="confirmpword">Confirm Password: </label>
			<input type="password" id="confirmpword" name="confirmpword" title="Confirm your password."><br><br>		
		</cfif>

		
		 <label for="email">* Email: </label>
			<input type="text" id="email" name="email"  value="#user.getemail()#" title="Enter your email"><br>		
		 <label for="firstName">* First Name: </label>
			<input type="text" id="firstName" name="firstName"  value="#user.getfirstName()#" title="Enter your first name."><br>
		 <label for="lastName">* Last Name: </label>
			<input type="text" id="lastName" name="lastName"  value="#user.getlastName()#" title="Enter your last name."><br>
		<cfif listfindnocase(roles,'admin') or listfindnocase(roles,'sysadmin')>
		 <label for="isActive">isActive: </label>
		 	<select id="isActive" name="isActive">
				<option value="1" <cfif user.getisActive() eq 1>selected</cfif>>Yes</option>
				<option value="0" <cfif user.getisActive() eq 0>selected</cfif>>No</option>
			</select><br>
		</cfif>
		<cfif listfindnocase(roles,'sysadmin')>
		 <label for="isSysAdmin">isSysAdmin: </label>
		 	<select id="isSysAdmin" name="isSysAdmin">
				<option value="1" <cfif user.getissysadmin() eq 1>selected</cfif>>Yes</option>
				<option value="0" <cfif user.getissysadmin() eq 0>selected</cfif>>No</option>
			</select><br>
		</cfif>
		<cfif listfindnocase(roles,'admin') or listfindnocase(roles,'sysadmin')>
		 <label for="isAdmin">isAdmin: </label>
			<select id="isAdmin" name="isAdmin">
				<option value="1" <cfif user.getisadmin() eq 1>selected</cfif>>Yes</option>
				<option value="0" <cfif user.getisAdmin() eq 0>selected</cfif>>No</option>
			</select><br>
		</cfif>
		<label for="submit"></label>
			<input type="submit" value="Save" id="submit" >
	</fieldset>
</form>
	
</cfoutput>